home *** CD-ROM | disk | FTP | other *** search
-
- ~4Dgifts/toolbox/src/exampleCode/opengl/x+opengl README
-
- `!' indicates new or updated as of version 4.2
-
-
- This directory contains source code from a three-part series of
- articles published in "The X Journal" about programming OpenGL and
- X, plus the renderboth.c program, based on glxmotif.c Included in
- each article is a complete program that is also reproduced here in
- compilable form.
-
-
-
- intro.ps: "OpenGL(tm) and X, Part 1: An Introduction", Mark Kilgard,
- "The X Journal", November/December, 1993.
-
- The OpenGL graphics system is a high-performance, window system
- independent 2D and 3D graphics interface. The technology was developed
- by Silicon Graphics and is now controlled by the OpenGL Architecture
- Review Board. OpenGL's GLX extension integrates OpenGL with the X
- Window System. This article describes OpenGL's functionality and how
- it is used with X. A simple OpenGL program using Xlib is presented.
- OpenGL is compared and contrasted with PEX, a 3D graphics interface
- designed specifically for X. The two subsequent articles in this
- series describe how to integrate OpenGL with Xlib and Motif programs.
-
- glxsimple.c A very simple OpenGL program rendering a cube which
- can be rotated using buttons presses. The program
- demonstrates creating a window for use with OpenGL,
- hidden surface removal, and double buffering. This
- program is presented in the first article in the
- November/December issue.
-
-
-
- xlib.ps: "OpenGL(tm) and X, Part 2: Using OpenGL with Xlib", Mark
- Kilgard, "The X Journal", January/February, 1994.
-
- This is the second article in a three-part series about using the
- OpenGL(tm) graphics system and the X Window System. A moderately
- complex OpenGL program for X is presented. Depth Buffering, back-face
- culling, lighting, display list modeling, polygon tessellation, double
- buffering, and shading are all demonstrated. The program adheres to
- proper X conventions for colormap sharing, window manager communication,
- command line argument processing, and event processing. After the
- example, advanced X and OpenGL issues are discussed including minimizing
- colormap flashing, handling overlays, using fonts, and performing
- animation. The last article in this series discussess integrating
- OpenGL with the Motif toolkit.
-
- glxdino.c A moderately complex OpenGL program that renders a 3D
- dinosaur which can be rotated with mouse input. The
- program demonstrates colormap sharing, proper set up
- of X window manager properties, maintaining window
- aspect ratios, back-face culling, double buffering,
- display list modeling, polygon tesselation, hidden
- surface removal, shading, lighting, and X event
- processing. This program is presented in the second
- article in the January/February issue.
-
-
-
- motif.PS: "OpenGL(tm) and X, Part 3: Integrating OpenGL with Motif",
- Mark Kilgard, "The X Journal", July/August, 1994.
-
- The OpenGL(tm) graphics system can be integrated with the
- industry-standard OSF/Motif user interface. This article
- discusses how to use OpenGL within a Motif application
- program. There are two approaches to using OpenGL with Motif.
- One is to render into a standard Motif drawing area widget, but
- this requires each application window to use a single visual
- for its window hierarchy. A better approach is to use the
- special OpenGL drawing area widget allowing windows used for
- OpenGL rendering to pick freely an appropriate visual without
- affecting the visual choice for other widgets. An example
- program demonstrates both approaches. The X Toolkit's work
- procedure mechanism animates the example's 3D paper airplanes.
- Handling OpenGL errors is also explained.
-
- paperplane.c A toy Motif program which draws 3D paperplanes
- flying in figure-eights on a sky background. The
- program demonstrates both how to use the OpenGL-
- specific Motif widget and how to use the standard
- Motif drawing area widget. Motif pull down menus to
- implement the GUI controls for the program. Work
- procs handle the animal. This program is presented in
- the third article in the July/August issue.
-
-
- glxmotif.c A program demonstrating how to use OpenGL with Motif
- (not using a special OpenGL widget). Work procs are
- used for animation. Press "s" to stop and start
- spinning the polygons; the arrow keys rotate the scene
- manually. This program is presented in the third
- article in the March/April issue. This program does
- not appear in any of the three articles, but appeared
- on the last Toolbox and appears here for completeness.
-
-
- ! renderboth.c This is an example of rendering with X and Open GL
- to the same window. Based on Mark Kilgard's glxmotif
- example, I also use a standard motif XmDrawingArea
- widget as the rendering medium.
-
- The example first draws the series of polygons that
- Mark's glxmotif used. Then I call XDrawLines to
- render a star composed of lines over the top of the
- Open GL-rendered polys.
-
- We will try to do double-buffered rendering if
- possible. This will happen if there is a double-
- buffered visual meeting the base depth criteria, that
- also has double-buffered X rendering capability. This
- is governed by the presence of the Xnmbx extension.
- If the Xnmbx extension is not available, or if the
- visual we turned up using glXChooseVisual on the base
- criteria does not have Xnmbx capability, we will fall
- back into single-buffering.
-
- The X multi-buffering extension is necessary to gain
- the proper synchronization between multibuffered
- rendering in X and Open GL. The XSync() call after
- both buffer swap calls (glXSwapBuffers and
- sgiXnmbxSwapWindow() is necessary to maintain
- synchronized buffer pointers as well.
-
- Without the buffer management layer provided by the
- Xnmbx extension, X will render to a static address in
- the drawable ... so your X rendering results will show
- up only every other time (since it seems to always
- render to what is the initial front buffer.
-
- Known problems :
-
- Trying to render in X to the active buffer does not work.
-
- pcd@sgi.com 7/94
-
-
- These programs will operate on an IRIS 4D machine running IRIX 5.1
- or later.
-